package xin.marcher.module.inventory.converter;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import xin.marcher.module.inventory.domain.bo.*;
import xin.marcher.module.inventory.domain.entity.InventoryAllotDetailDO;
import xin.marcher.module.inventory.domain.entity.InventoryBucketOperateDO;
import xin.marcher.module.inventory.domain.entity.InventoryDeductionDetailDO;
import xin.marcher.module.inventory.domain.entity.InventoryOperateFailDO;
import xin.marcher.module.inventory.domain.request.*;
import xin.marcher.module.inventory.domain.response.BucketCacheDTO;
import xin.marcher.module.inventory.domain.response.WarningInventoryDTO;

import java.util.List;

/**
 * 库存 相关对象克隆
 *
 * 
 */
@Mapper(componentModel = "spring")
public interface InventoryConverter {
    /**
     * 对象克隆
     *
     * @param inventorBucketRequest
     * @return
     */
    @Mapping(target = "inventorNo", source = "inventorCode")
    InventoryAllotDetailDO converterDO(InventorBucketRequest inventorBucketRequest);


    /**
     * 对象克隆
     *
     * @param request
     * @return
     */
    InventoryDetail converterRequest(InventoryRequest request);

    /**
     * 对象克隆
     *
     * @param request
     * @return
     */
    InventorOnlineRequest converterRequest(InventorBucketRequest request);

    /**
     * 对象克隆
     *
     * @param bucketCapacity
     * @return
     */
    InventorOfflineRequest converter(BucketCapacity bucketCapacity);

    /**
     * 对象克隆
     *
     * @param request
     * @return
     */
    BucketCapacity converter(BucketClearRequest request);


    /**
     * 对象克隆
     *
     * @param bucketLocalCache
     * @return
     */
    WarningInventoryDTO converterDTO(BucketLocalCache bucketLocalCache);

    /**
     * 对象克隆
     *
     * @param inventoryDetail
     * @return
     */
    BucketCapacity converter(InventoryDetail inventoryDetail);

    /**
     * 对象克隆
     *
     * @param inventoryDetail
     * @return
     */
    @Mapping(target = "updateUser", source = "userId")
    InventoryDeductionDetailDO converterDO(InventoryDetail inventoryDetail);

    /**
     * 集合对象克隆
     *
     * @param inventoryDetailList
     * @return
     */
    List<InventoryDeductionDetailDO> converterDOList(List<InventoryDetail> inventoryDetailList);

    /**
     * 对象克隆
     *
     * @param inventoryDetail
     * @return
     */
    InventoryDetail converter(InventoryDeductionDetailDO inventoryDetail);

    /**
     * 集合对象克隆
     *
     * @param inventoryDetail
     * @return
     */
    List<InventoryDetail> converterList(List<InventoryDeductionDetailDO> inventoryDetail);

    /**
     * 集合对象克隆
     *
     * @param bucketCacheBOList
     * @return
     */
    List<BucketCacheDTO> converterDTOList(List<BucketCacheBO> bucketCacheBOList);

    /**
     * 集合对象克隆
     *
     * @param inventoryBucketOperateDOS
     * @return
     */
    List<InventoryBucketOperateBO> converter(List<InventoryBucketOperateDO> inventoryBucketOperateDOS);

    /**
     * 集合对象克隆
     *
     * @param inventoryOperateFailDOS
     * @return
     */
    List<InventoryOperateFailBO> converterOperateFailList(List<InventoryOperateFailDO> inventoryOperateFailDOS);
}
